<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>首次会议------监理项目用章授权书</title>

    <!--公用样式-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/comment.css"/>
    <!--页面样式-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/style.css"/>
    <!--Layui-->
    <link rel="stylesheet" href="${re.contextPath}/plugin/layui/css/layui.css" media="all"/>
    <!--extended-->
    <link rel="stylesheet" type="text/css" href="${re.contextPath}/plugin/common/css/extended.css"/>
    <!--公用样式JS-->
    <script type="text/javascript" src="${re.contextPath}/plugin/jquery/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="${re.contextPath}/plugin/common/js/comment.js"></script>
    <script type="text/javascript" src="${re.contextPath}/plugin/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${re.contextPath}/plugin/tools/tool.js"></script>
    <script type="text/javascript" src="${re.contextPath}/pageoffice.js" id="po_js_main"></script>
</head>
<style>
    .windows {
        background-color: #f8f8f8;
    }

    .popUp {
        width: 90%;
    }

</style>

<body>

<!--监理印章使用授权书-->
<div class="windows">
    <div class="popUp whitebg">
        <div class="popUpTitle ft24 bold">监理印章使用授权书</div>
        <div class="clearfix mt10">
            <span class="fl">SDZZ-QR002</span>
        </div>
        <div class="popUpBox book">
            <form action="" class="layui-form addform">
                <table>
                    <tr>
                        <td style="border: 1px solid #CCCCCC;">工程名称</td>
                        <td style="border: 1px solid #CCCCCC;">
                            <input type="hidden" name="spfPrjid" value="${spf_prjid}">
                            <input type="hidden" name="fileInd" value="${ind}">
                            <input type="hidden" name="spfStaid" value="${spf_staid}">
                            <input type="hidden" name="spfMilid" value="${spf_milid}">
                            <input type="hidden" name="projectName" value="${pdto.projectName}">
                            <input type="hidden" name="spfFilecode" value="${spfFilecode}">
                            <input type="hidden" name="bfcId" value="15">
                            <input type="hidden" name="fbCode" value="${fbCode}">
                            <input type="hidden" name="pcId" value="${pcId}">
                            <input type="hidden" name="wjNum" value="31">
                            <input type="hidden" name="imageurl"  id="imageurl" value="${qzimageurl}">
                            <input type="hidden" name="imgName"  id="imgName" value="">
                            <input type="hidden" name="spfF8" id="spfF8" value="${pdto.supervisorCompanyName}">
                            <input type="hidden" name="spfF7" id="spfF7" value="${pdto.supervisorCompanyName}">

                            <input type="text" name="spfF1" id="spfF1" value="${pdto.projectName}" lay-verify="spfF1"
                                   style="width: 40%;">
                            <#list listqzlist as vo>
                                <input class="qzlist"  type="hidden" value="${vo.url}" name="${vo.fileName}" laydata="${vo.linkId}">
                            </#list>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="10">
                            <ul class="left">
                                <li>致：<input type="text" placeholder="甲方名称" name="spfF2" lay-verify="spfF2" style="width: 80%;"
                                             value="${pdto.owerCompany}">
                                </li>
                                <li>一、现授权监理机构在
                                    <input type="text" placeholder="" style="width: 40%;" name="spfF3"
                                           lay-verify="spfF3"
                                           value="${pdto.projectName}">的监理实施过程中使用项目印章

                            <div class="spfF5" id="spfF5"></div>
                              <#--      <select name="spfF5" id="spfF5" class="ml10" lay-verify="spfF5" lay-filter="spfF5"
                                            style="width:30% !important;">
                                        <option value="">请选择</option>
                                        <#list xmzlist as vo>
                                            <option value="${vo.badtLevel1}">${vo.badtName}</option>
                                        </#list>
                                    </select>-->
                                    （如下图）。
                                </li>
                                <li>二、授权期限：从收到本授权书之日起至本项目监理合同及监理业务完成终止之日止。</li>
                                <li>三、印章使用范围：所有应由监理机构审核签认的工程资料和来往文件。</li>
                                <li>四、现场监理机构对项目章的使用进行严格管理，做到专章专用。</li>
                            </ul>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <div class="chapter clearfix whitebg">
                                <div class="gary fl">项目印章样板</div>
                                <input type="hidden" name="spfF6" id="spfF6" lay-verify="spfF6">
                                <div class="fr">
                                    <img src=""  style="display: none" id="img_yz" alt="签章图片"  >
                                </div>
                            </div>
                        </td>
                    </tr>
                </table>
                <div class="popUpBtn center">
                    <button type="button" class="blue bgnone close">关闭</button>
                    <button type="button" class="bluebg white" lay-submit lay-filter="submit">提交</button>
                </div>
            </form>
        </div>
    </div>
</div>

<#-- 可以多选的下拉框 -->
<script src="${re.contextPath}/plugin/layui/xm-select.js"></script>
<script>
    var layer;
    var form;
    layui.use(['form', 'laydate', 'layer'], function () {
        layer = layui.layer;
        form = layui.form;
        selectInnit();
        form.verify({
            spfF1: function (v) {
                if (v.trim() == '') {
                    return "工程名称不能为空";
                }
            },
            spfF2: function (v) {
                if (v.trim() == '') {
                    return "甲方不能为空";
                }
            },
            spfF3: function (v) {
                if (v.trim() == '') {
                    return "工程名称不能为空";
                }
            },
            spfF4: function (v) {
                if (v.trim() == '') {
                    return "监理单位名称不能为空";
                }
            }
            // ,
            // spfF5: function (v) {
            //     if (v.trim() == '') {
            //         return "请选择项目印章";
            //     }
            // }

        });

        function selectInnit(){
            _gpakgs = [];
            $(".qzlist").each(function (i, v) {
                var value= $(v).attr("value");
                var name= $(v).attr("name");
                var laydata= $(v).attr("laydata");

                _gpakgs.push({name: name, value: value,laydata:laydata});
            });
            _xst = xmSelect.render({
                el: '#spfF5',
                name: 'spfF5',
                radio:true,
                filterable: true,
                layVerify: false,
                toolbar: {show: true,list: new Array("CLEAR")},
                on({ arr, item, selected }){
                    if(arr.length>0){
                        console.log(arr);

                        var url=arr[0].value;
                        arr[0].name;
                        var  zsurl=arr[0].laydata;// 完整的url
                        var im="[image]file://"+zsurl+"[/image]";
                        $("#spfF6").val(im);
                        $("#imgName").val(arr[0].name)
                        $("#img_yz").css("display","block")
                        $("#img_yz").attr("src", url)
                        $("#spfF7").val( zsurl)
                    }

                },
                layVerType: 'msg',
                data: _gpakgs,
                strict: true
            });

            console.log($(_xst))
        }
       // form.on('select(spfF5)', function (data) {
       //
       //
       //      var url = data.value;
       //      if (url == "") {
       //          return;
       //      }
       //      var im="[image]"+url+"[/image]";
       //      $("#spfF6").val(im);
       //      $("#img_yz").attr("src", url)
       //  });
        //监听提交
        form.on('submit(submit)', function (data) {
            data.field.spfF5 = $("#imgName").val();
            layerAjax('/supervisor/projectManager/addFormFile', data.field, '', function (d) {
                console.log()
                if (d.flag == true) {
                    var spfId = d.data.spfId;// fmid
                    var fpid = d.data.fpid;// fpid
                    POBrowser.openWindowModeless('/sys/office/openword?ft=2&fmid=' + spfId + '&fpid=' + fpid, 'width=1200px;height=800px;', '{}')
                } else {
                    layer.msg(d.msg, {icon: 2});
                }
                console.log(d);
            });
            return false;

        });

        $('.close').click(function () {
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        });
        form.render();


    });

</script>


<!-- 底部结束 -->
</body>
</html>
